import java.util.Scanner;

public class test14 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int flag = in.nextInt();
        int a,b,c;
        int x,y;
        while(flag--!=0){
            a = in.nextInt();
            b = in.nextInt();
            c = in.nextInt();

            x = Math.min(a,Math.min(b,c));
            y = Math.max(b-x-1,0);
            System.out.println(x*2+y);
        }
    }
}
